import request from '/@/utils/request';

/**
 * 视频图片
 * @param params 要传的参数值
 * @returns 返回接口数据
 * 视频图片api接口集合
 */
export function useResourceApi() {
	return {
		getPicList: (params) => {
			return request({
				url: '/admin/minio/pic/list',
				method: 'post',
				data: {
					...params,
					type: 0,
				},
			});
		},
		getPicListByTime: (data) => {
			return request({
				url: '/admin/minio/pic/listByDate/0',
				method: 'post',
				data,
			});
		},
		getPicTimeList: () => {
			return request({
				url: '/admin/minio/pic/picDateList',
				method: 'post',
				data: {
					type: 0,
				},
			});
		},
		delPicById: (data) => {
			console.log('0====', data);
			return request({
				url: '/admin/minio/pic/disable',
				method: 'post',
				data,
			});
		},

		// 视频接口
		getVideoList: (params) => {
			return request({
				url: '/admin/minio/pic/list',
				method: 'post',
				data: {
					...params,
					type: 1,
				},
			});
		},
		getVideoListByTime: (data) => {
			return request({
				url: '/admin/minio/pic/listByDate/1',
				method: 'post',
				data,
			});
		},
		getVideoTimeList: () => {
			return request({
				url: '/admin/minio/pic/picDateList',
				method: 'post',
				data: {
					type: 1,
				},
			});
		},
		delVideoById: (data) => {
			return request({
				url: '/admin/minio/pic/disable',
				method: 'post',
				data,
			});
		},
		reNameVideo: (data) => {
			return request({
				url: '/admin/minio/video/update',
				method: 'post',
				data,
			});
		},

		// 附件接口
		getAttachmentList: (params) => {
			return request({
				url: '/admin/minio/pic/list',
				method: 'post',
				data: {
					...params,
					type: 2,
				},
			});
		},
		getAttachmentListByTime: (data) => {
			return request({
				url: '/admin/minio/pic/listByDate/2',
				method: 'post',
				data,
			});
		},
		getAttachmentTimeList: () => {
			return request({
				url: '/admin/minio/pic/picDateList',
				method: 'post',
				data: {
					type: 2,
				},
			});
		},
		delAttachmentById: (data) => {
			return request({
				url: '/admin/minio/pic/disable',
				method: 'post',
				data,
			});
		},
		reNameAttachment: (data) => {
			return request({
				url: '/admin/minio/video/update',
				method: 'post',
				data,
			});
		},
		//图片、视频、文件保存
		saveUpload: (data) => {
			return request({
				url: '/admin/minio/upload',
				method: 'post',
				data,
			});
		},
	};
}
